
<template>
  <a-row :gutter="10">
    <a-col :md="6" :sm="24" >
      <a-card :bordered="false" style="height:900px">
<!--        <div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">-->
<!--          <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入部门名称"/>-->
          <!-- 树-->

          <!--          <template v-if="userIdentity === '2' && departTree.length>0">-->

          <!--组织机构-->
          <a-tree
            showLine
            :expandedKeys="expandedKeys"
            @select="onSelect"
            :treeData="deptTreeData"
            :autoExpandParent="true"
            @expand="onExpand"
          />

          <!--          </template>-->
          <!--          <div style="margin-top: 24px;" v-else-if="userIdentity === '2' && departTree.length==0">-->
          <!--            <h3><span>您的部门下暂无有效部门信息</span></h3>-->
          <!--          </div>-->
          <!--          <div style="margin-top: 24px;" v-else><h3>普通员工暂无此权限</h3></div>-->
<!--        </div>-->
      </a-card>
    </a-col>
    <a-col :md="18" :sm="24">
      <a-card :bordered="false" style="height:900px">

        <employee-list-right ref="EmployeeListRight" ></employee-list-right>
<!--        <user-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></user-form>-->
        <!--        <a-tabs defaultActiveKey="2" @change="callback">-->
        <!--          <a-tab-pane tab="基本信息" key="1" forceRender>-->
        <!--            <Dept-Base-Info ref="DeptBaseInfo"></Dept-Base-Info>-->
        <!--          </a-tab-pane>-->
        <!--          <a-tab-pane tab="用户信息" key="2">-->
        <!--            <Dept-User-Info ref="DeptUserInfo" @clearSelectedDepartKeys="clearSelectedDepartKeys"></Dept-User-Info>-->
        <!--          </a-tab-pane>-->
        <!--          <a-tab-pane tab="部门角色" key="3" forceRender>-->
        <!--            <dept-role-info ref="DeptRoleInfo" @clearSelectedDepartKeys="clearSelectedDepartKeys"/>-->
        <!--          </a-tab-pane>-->
        <!--        </a-tabs>-->
      </a-card>
    </a-col>
  </a-row>
</template>



<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import EmployeeModal from './EmployeeModal'
  import EmployeeListRight from './EmployeeListRight'
  import { getAction } from '../../../api/manage'
  import { FormMixin } from '@/mixins/FormMixin'
  import { requestSetData } from '../../../utils/commonUtils'

  export default {
    name: 'EmployeeList',
    mixins: [ mixinDevice,FormMixin],
    components: {
      EmployeeModal,
      EmployeeListRight

    },
    data() {
      return {
        description: '',
        expandedKeys:[],
        deptTreeData:[],
        // dictOptions: {},
        // dataSourceOptions:[],
        // templateOptions:[],
        // superFieldList: [],
      }
    },
    created() {


      let $this = this;
      requestSetData("/user/dept/listTree",{},function(data){
        $this.deptTreeData = data;
        $this.deptTreeData.forEach(data=>{
          $this.expandedKeys.push(data.key);
        })
      });
      // getAction("/user/dept/listTree",{}).then(res=>{
      //   if(res.success){
      //
      //     this.deptTreeData = res.data;
      //     this.deptTreeData.forEach(data=>{
      //       $this.expandedKeys.push(data.key);
      //     })
      //     console.log("deptTreeData="+this.deptTreeData);
      //   }
      // });

      // getAction("/user/dataSource/listAll",{}).then(res=>{
      //   if(res.success){
      //     this.dataSourceOptions = res.data.map((item,index,arr)=>{
      //       let c = {label:item.name, value: item.id}
      //       return c;
      //     });
      //     console.log("dataSourceOptions="+this.dataSourceOptions);
      //   }
      // });
      // getAction("/user/template/listAll",{}).then(res=>{
      //   if(res.success){
      //     this.templateOptions = res.data.map((item,index,arr)=>{
      //       let c = {label:item.name, value: item.id}
      //       return c;
      //     });
      //     console.log("templateOptions="+this.templateOptions);
      //   }
      // });
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      },
    },
    methods: {
      initDictConfig() {
      },
      onSelect(selectedKeys, e) {
        console.log(selectedKeys)

        let record = e.node.dataRef;
        console.log("record="+record);
        this.$refs.EmployeeListRight.initRefresh(selectedKeys[0]);
      },

      onExpand(expandedKeys) {
        console.log("expandedKeys="+expandedKeys)
        this.expandedKeys = expandedKeys
      },
      expand(expanded, record) {
        // if(expanded){
        //   let key = this.expandedRowKeys.pop()
        //   this.expandedRowKeys1 = []
        //   this.expandedRowKeys1.push(key)
        //   // 根据选中的数据查询接口
        //   const data = {
        //     variablesGroupId: record.id
        //   }
        //   variableList(data).then(res => {
        //     this.variableInnerData = res.result.records
        //   })
        // }
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>